package com.fulong.service.impl;

import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fulong.common.utils.PageUtils;
import com.fulong.common.utils.Query;

import com.fulong.dao.DevicePayInfoDao;
import com.fulong.entity.DevicePayInfoEntity;
import com.fulong.service.DevicePayInfoService;


@Service("devicePayInfoService")
public class DevicePayInfoServiceImpl extends ServiceImpl<DevicePayInfoDao, DevicePayInfoEntity> implements DevicePayInfoService {

    @Override
    public Map<String, Object> getBuyRecordInfo(String id) {
        return baseMapper.getBuyRecordInfo(id);
    }

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        //分页问题
        int currentpage  = 1 ;
        if(params.get("page")!=null) {
            currentpage = Integer.parseInt(params.get("page").toString());
            params.remove("page") ;
        }
        HashMap<String , Object> map = new HashMap<>();
        IPage<DevicePayInfoEntity> page = this.page(
                new Query<DevicePayInfoEntity>().getPage(params),
                new QueryWrapper<DevicePayInfoEntity>()
        );

        return new PageUtils(page);
    }

}